<!-- 精选板块管理 -->
<template>
  <div class="p-4">
    <BasicTable row-key="id" @register="registerTable">
      <template #bodyCell="{ column, record }">
        <template v-if="column.key === 'action'">
          <TableAction
            :actions="[
              {
                label: '板块配置',
                onClick: () => {
                  router.push(`/hby/resourceLeague/plateSet?id=${record.id}`);
                },
              }
            ]"
          ></TableAction>
        </template>
      </template>
    </BasicTable>
  </div>
</template>

<script lang="ts" setup>
  import { BasicTable, useTable, TableAction } from '@/components/Table';
  import { useRouter } from 'vue-router';
  import { getMerchantTemplateList } from '@/api/hby/resourceLeague/index'

  const router = useRouter();
  
  const [registerTable, { reload }] = useTable({
    api: (params: any) => {
      return getMerchantTemplateList();
    },
    columns: [
      {
        title: '板块名称',
        dataIndex: 'templateName',
        width: 272,
        align: 'center',
      },
      {
        title: '产品数量',
        dataIndex: 'productNum',
        width: 150,
        align: 'center',
      },
      {
        title: '推广组织',
        dataIndex: 'orgNum',
        width: 100,
        align: 'center',
      },
      // {
      //   title: '售出订单',
      //   dataIndex: 'orderNum',
      //   width: 100,
      //   align: 'center',
      // },
      {
        title: '创建时间',
        dataIndex: 'createTime',
        width: 200,
        align: 'center',
      },
    ],
    actionColumn: {
      width: 200,
      title: '操作',
      dataIndex: 'action',
    },
  });
</script>

<style lang="less" scoped></style>
